package com.xiao.controller;

import com.xiao.entity.User;
import com.xiao.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Administrator on 2016/3/10 0010.
 */
@Controller
@RequestMapping(value = "/user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping(value = "/list",method ={RequestMethod.GET,RequestMethod.POST})
    public String UserList(HttpServletRequest request, Model model){
        User user = userService.get(1l);
        model.addAttribute("user",user);
        return "/user";
    }
}
